<template>
  <div class="swipper-wrapper">
    <swiper :options="swiperOption" v-if="show">
      <swiper-slide class="wrapper" v-for="item of swiperList" :key="item.id" >
        <img class="swiper-img" :src="item.imgUrl" alt="">
      </swiper-slide>
      <div class="swiper-pagination "  slot="pagination"></div>
    </swiper>
  </div>
</template>

<script>
export default {
  name: 'HomeSwiper',
  props: {
    swiperList: Array
  },
  data () {
    return {
      swiperOption: {
        pagination: '.swiper-pagination',
        loop: true,
        autoplay: 3000
      }
    }
  },
  computed: {
    show () {
      return this.swiperList.length
    }
  }
}
</script>

<style scoped lang="stylus">
.wrapper
  width:100%;
  padding-bottom:26%;
  overflow:hidden;
  height:0;
  background:pink
  .swiper-img
    width:100%;
.swipper-wrapper>>> .swiper-pagination-bullet{background:#000;}
.swipper-wrapper>>> .swiper-pagination-bullet-active{background:#fff}

</style>
